﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SportsStore.ServicesInterfaces;
using SportsStore.Model;
using SportsStore.Repository.Interfaces;

namespace SportsStore.Services
{
  public class CategoryService : ICategoryService
  {
    readonly ICategoryRepository _categoryRepository;

    public CategoryService(ICategoryRepository productRepository)
    {
      _categoryRepository = productRepository;
    }

    public IEnumerable<string> GetCategories()
    {
      try
      {
        return _categoryRepository.GetCategories();
      }
      catch (Exception e)
      {
        throw new SportsStoreException("Unable to retrieve categories", e);
      }
    }
  }
}
